#!/usr/bin/env python

import requests
import sys
import json
from texttable import Texttable, get_color_string, bcolors

url = "http://localhost:5000"

def usage():
    print \
"""Usage:
 fu hosts list
"""


def do_hosts(action):
    if action == "list":
        res = requests.get(url + "/hosts")
        return res.text
    if action == "add":
        data = {"host_name": "ceph1"}
        res = requests.post(url + "/hosts", data = data)


def get_table(attributes=[]):
    table = Texttable()
    table.set_cols_align("c", "c", "c")
    table.set_cols_valign([]) 

def main():
    if len(sys.argv) < 3:
        usage()
        exit(0)
    elif sys.argv[1] == "hosts":
        hosts = do_hosts(sys.argv[2])


if __name__ == "__main__":
    main()
